


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->

<!-- Mirrored from www.cyclismo.org/tutorial/matlab/if.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 04:32:29 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>The If Statement &mdash; Matlab Tutorial 3.0 documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  
    <link rel="stylesheet" href="_static/siteColours.css" type="text/css" />
  

  
    <link rel="top" title="Matlab Tutorial 3.0 documentation" href="index.html"/>
        <link rel="next" title="Data Files" href="dataFile.html"/>
        <link rel="prev" title="Subroutines" href="subroutine.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> Matlab Tutorial
          

          
          </a>

          
            
            
              <div class="version">
                3.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="https://www.cyclismo.org/tutorial/matlab/search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          

<div class="local-toc"><ul>
<li><a class="reference internal" href="#">The If Statement</a><ul>
<li><a class="reference internal" href="#example">Example</a></li>
</ul>
</li>
</ul>
</div>
					


<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="vector.html">Introduction to Vectors in Matlab</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrix.html">Introduction to Matrices in Matlab</a></li>
<li class="toctree-l1"><a class="reference internal" href="operations.html">Vector Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="control.html">Loops</a></li>
<li class="toctree-l1"><a class="reference internal" href="plot.html">Plotting</a></li>
<li class="toctree-l1"><a class="reference internal" href="execute.html">Executable Files</a></li>
<li class="toctree-l1"><a class="reference internal" href="subroutine.html">Subroutines</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">The If Statement</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#example">Example</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dataFile.html">Data Files</a></li>
</ul>


<div class="datacampAd">
  <span style="vertical-align:top;color: black;">
<center>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-8301099787686694";
google_ad_width = 120;
google_ad_height = 240;
google_ad_type = "text_image";
google_ad_channel ="6171035172";
google_ad_slot = "4696657180";
google_color_border = "808080";
google_color_bg = "F0ECEC";
google_color_link = "000000";
google_color_url = "666666.html";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
  src="../../../pagead2.googlesyndication.com/pagead/f.txt">
</script>
</center>
</span>
</div>


        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="index.html">Matlab Tutorial</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          





<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="index.html">Docs</a> &raquo;</li>
      
    <li>The If Statement</li>
      <li class="wy-breadcrumbs-aside">
        
          
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="the-if-statement">
<h1>The If Statement<a class="headerlink" href="#the-if-statement" title="Permalink to this headline">¶</a></h1>
<p>In this tutorial we will assume that you know how to create vectors
and matrices, know how to index into them, and know about loops. For
more information on those topics see one of our tutorials on vectors
(<a class="reference internal" href="vector.html#vectors"><span>Introduction to Vectors in Matlab</span></a>), matrices (<a class="reference internal" href="matrix.html#matrices"><span>Introduction to Matrices in Matlab</span></a>), vector operations
(<a class="reference internal" href="operations.html#vectoroperations"><span>Vector Functions</span></a>), loops (<a class="reference internal" href="control.html#loops"><span>Loops</span></a>), plotting
(<a class="reference internal" href="plot.html#plotting"><span>Plotting</span></a>), executable files (<a class="reference internal" href="execute.html#executablefile"><span>Executable Files</span></a>), or
subroutines (<a class="reference internal" href="subroutine.html#subroutines"><span>Subroutines</span></a>).</p>
<p>There are times when you want your code to make a decision. For
example, if you are approximating a differential equation, and the
rate of change is discontinuous, you may want to change the rate
depending on what time step you are on.</p>
<p>Here we will define an executable file that contains an if statement.
The file is called by Matlab, and it constructs a second derivative
finite difference matrix with boundary conditions. There is a variable
in the file called <em>decision</em>. If this variable is less than 3, the
file will find and plot the eigen values of the matrix, if it is
greater than 3 the eigen values of the inverse of the matrix are found
and plotted, otherwise, the system is inverted to find an
approximation to <em>y&#8217;=sin(x)</em> according to the specified boundary
conditions.</p>
<p>There are times when you want certain parts of your program to be
executed only in limited circumstances. The way to do that is to put
the code within an &#8220;if&#8221; statement. The most basic structure for an
&#8220;if&#8221; statement is the following:</p>
<span class="target" id="index-0"></span><div class="highlight-matlab" id="index-1"><div class="highlight"><pre><span class="k">if</span>  <span class="p">(</span><span class="n">condition</span> <span class="n">statement</span><span class="p">)</span>
    <span class="p">(</span><span class="n">matlab</span> <span class="n">commands</span><span class="p">)</span>
<span class="k">end</span>
</pre></div>
</div>
<p>More complicated structures are also possible including combinations
like the following:</p>
<span class="target" id="index-2"></span><div class="highlight-matlab" id="index-3"><div class="highlight"><pre><span class="k">if</span>  <span class="p">(</span><span class="n">condition</span> <span class="n">statement</span><span class="p">)</span>
    <span class="p">(</span><span class="n">matlab</span> <span class="n">commands</span><span class="p">)</span>
<span class="k">elseif</span>  <span class="p">(</span><span class="n">condition</span> <span class="n">statement</span><span class="p">)</span>
    <span class="p">(</span><span class="n">matlab</span> <span class="n">commands</span><span class="p">)</span>
<span class="k">elseif</span> <span class="p">(</span><span class="n">condition</span> <span class="n">statement</span><span class="p">)</span>
    <span class="p">(</span><span class="n">matlab</span> <span class="n">commands</span><span class="p">)</span>
<span class="p">.</span>
<span class="p">.</span>
<span class="p">.</span>
<span class="k">else</span>
    <span class="p">(</span><span class="n">matlab</span> <span class="n">commands</span><span class="p">)</span>
<span class="k">end</span>
</pre></div>
</div>
<p>The conditions are boolean statements and the standard comparisons can
be made. Valid comparisons include &#8220;&lt;&#8221; (less than), &#8220;&gt;&#8221; (greater
than), &#8220;&lt;=&#8221; (less than or equal), &#8220;&gt;=&#8221; (greater than or equal), &#8220;==&#8221;
(equal - this is two equal signs with no spaces betweeen them), and
&#8220;=&#8221; (not equal). For example, the following code will set the variable
j to be -1:</p>
<span class="target" id="index-4"></span><span class="target" id="index-5"></span><span class="target" id="index-6"></span><span class="target" id="index-7"></span><div class="highlight-matlab" id="index-8"><div class="highlight"><pre><span class="n">a</span> <span class="p">=</span> <span class="mi">2</span><span class="p">;</span>
<span class="n">b</span> <span class="p">=</span> <span class="mi">3</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">a</span><span class="o">&lt;</span><span class="n">b</span><span class="p">)</span>
    <span class="nb">j</span> <span class="p">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
<span class="k">end</span>
</pre></div>
</div>
<p>Additional statements can be added for more refined decision making.
The following code sets the variable j to be 2.</p>
<div class="highlight-matlab"><div class="highlight"><pre><span class="n">a</span> <span class="p">=</span> <span class="mi">4</span><span class="p">;</span>
<span class="n">b</span> <span class="p">=</span> <span class="mi">3</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">a</span><span class="o">&lt;</span><span class="n">b</span><span class="p">)</span>
    <span class="nb">j</span> <span class="p">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">a</span><span class="o">&gt;</span><span class="n">b</span><span class="p">)</span>
    <span class="nb">j</span> <span class="p">=</span> <span class="mi">2</span><span class="p">;</span>
<span class="k">end</span>
</pre></div>
</div>
<p>The else statement provides a catch all that will be executed if no
other condition is met. The following code sets the variable <em>j</em> to be
3.</p>
<div class="highlight-matlab"><div class="highlight"><pre><span class="n">a</span> <span class="p">=</span> <span class="mi">4</span><span class="p">;</span>
<span class="n">b</span> <span class="p">=</span> <span class="mi">4</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">a</span><span class="o">&lt;</span><span class="n">b</span><span class="p">)</span>
    <span class="nb">j</span> <span class="p">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">a</span><span class="o">&gt;</span><span class="n">b</span><span class="p">)</span>
    <span class="nb">j</span> <span class="p">=</span> <span class="mi">2</span><span class="p">;</span>
<span class="k">else</span>
    <span class="nb">j</span> <span class="p">=</span> <span class="mi">3</span>
<span class="k">end</span>
</pre></div>
</div>
<p>This last example demonstrates one of the bad habits that Matlab
allows you to get away with. With finite precision arithmetic two
variables are rarely exactly the same. When using C or FORTRAN you
should never compare two floating numbers to see if they are the same.
Instead you should check to see if they are <strong>close</strong>. Matlab does not
use integer arithmetic so if you check to see if two numbers are the
same it <strong>automatically</strong> checks to see if the variables are close .
If you were to use C or FORTRAN then that last example could get you
into big trouble. but Matlab does the checking for you in case the
numbers are just really close.</p>
<p>Matlab allows you to string together multiple boolean expressions
using the standard logic operators, &amp; (and) , | (or) , and ~
(not). For example to check to see if <em>a</em> is less than <em>b</em> and at the
same time <em>b</em> is greater than or equal to <em>c</em> you would use the
following commands:</p>
<div class="highlight-matlab"><div class="highlight"><pre><span class="k">if</span> <span class="p">(</span><span class="n">a</span> <span class="o">&lt;</span> <span class="n">b</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">b</span> <span class="o">&gt;</span><span class="p">=</span> <span class="n">c</span><span class="p">)</span>
   <span class="n">Matlab</span> <span class="n">commands</span>
<span class="k">end</span>
</pre></div>
</div>
<div class="section" id="example">
<span id="ifexample"></span><h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>If you are not familiar with creating exectable files see our tutorial
on the subject (<a class="reference internal" href="execute.html#executablefile"><span>Executable Files</span></a>). Otherwise, copy the following
script into a file called <a class="reference download internal" href="_downloads/ifDemo.m"><code class="xref download docutils literal"><span class="pre">ifDemo.m</span></code></a>.</p>
<div class="highlight-matlab"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64</pre></div></td><td class="code"><div class="highlight"><pre> <span class="n">decision</span> <span class="p">=</span> <span class="mi">3</span><span class="p">;</span>
 <span class="n">leftx</span> <span class="p">=</span> <span class="mi">0</span><span class="p">;</span>
 <span class="n">rightx</span> <span class="p">=</span> <span class="mi">1</span><span class="p">;</span>

 <span class="n">lefty</span> <span class="p">=</span> <span class="mi">1</span><span class="p">;</span>
 <span class="n">righty</span> <span class="p">=</span> <span class="mi">1</span><span class="p">;</span>

 <span class="n">N</span><span class="p">=</span> <span class="mi">10</span><span class="p">;</span>
 <span class="n">h</span> <span class="p">=</span> <span class="p">(</span><span class="n">rightx</span><span class="o">-</span><span class="n">leftx</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">N</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
 <span class="n">x</span> <span class="p">=</span> <span class="p">[</span><span class="n">leftx</span><span class="p">:</span><span class="n">h</span><span class="p">:</span><span class="n">rightx</span><span class="p">]</span><span class="o">&#39;</span><span class="p">;</span>

 <span class="n">A</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="n">N</span><span class="p">);</span>

 <span class="k">for</span> <span class="nb">i</span><span class="p">=</span><span class="mi">2</span><span class="p">:</span><span class="n">N</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span>
    <span class="n">A</span><span class="p">(</span><span class="nb">i</span><span class="p">,</span><span class="nb">i</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span><span class="nb">i</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="p">[</span><span class="mi">1</span> <span class="o">-</span><span class="mi">2</span> <span class="mi">1</span><span class="p">];</span>
 <span class="k">end</span>

 <span class="n">A</span> <span class="p">=</span> <span class="n">A</span><span class="o">/</span><span class="n">h</span>^<span class="mi">2</span><span class="p">;</span>

 <span class="n">A</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="mi">1</span><span class="p">;</span>
 <span class="n">A</span><span class="p">(</span><span class="n">N</span><span class="p">,</span><span class="n">N</span><span class="p">)</span> <span class="p">=</span> <span class="mi">1</span><span class="p">;</span>

 <span class="n">b</span> <span class="p">=</span> <span class="nb">sin</span><span class="p">(</span><span class="n">x</span><span class="p">);</span>
 <span class="n">b</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="n">lefty</span><span class="p">;</span>
 <span class="n">b</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> <span class="p">=</span> <span class="n">righty</span><span class="p">;</span>

 <span class="k">if</span><span class="p">(</span><span class="n">decision</span><span class="o">&lt;</span><span class="mi">3</span><span class="p">)</span>

     <span class="c">% Find and plot the eigen values</span>
     <span class="p">[</span><span class="n">e</span><span class="p">,</span><span class="n">v</span><span class="p">]</span> <span class="p">=</span> <span class="n">eig</span><span class="p">(</span><span class="n">A</span><span class="p">);</span>
     <span class="n">e</span> <span class="p">=</span> <span class="nb">diag</span><span class="p">(</span><span class="n">e</span><span class="p">);</span>
     <span class="n">plot</span><span class="p">(</span><span class="nb">real</span><span class="p">(</span><span class="n">e</span><span class="p">),</span><span class="nb">imag</span><span class="p">(</span><span class="n">e</span><span class="p">),</span><span class="s">&#39;rx&#39;</span><span class="p">);</span>
     <span class="n">title</span><span class="p">(</span><span class="s">&#39;Eigen Values of the matrix&#39;</span><span class="p">);</span>

 <span class="k">elseif</span><span class="p">(</span><span class="n">decision</span><span class="o">&gt;</span><span class="mi">3</span><span class="p">)</span>

     <span class="c">% Find and plot the eigen values of inv(A)</span>
     <span class="p">[</span><span class="n">e</span><span class="p">,</span><span class="n">v</span><span class="p">]</span> <span class="p">=</span> <span class="n">eig</span><span class="p">(</span><span class="n">inv</span><span class="p">(</span><span class="n">A</span><span class="p">));</span>
     <span class="n">e</span> <span class="p">=</span> <span class="nb">diag</span><span class="p">(</span><span class="n">e</span><span class="p">);</span>
     <span class="n">plot</span><span class="p">(</span><span class="nb">real</span><span class="p">(</span><span class="n">e</span><span class="p">),</span><span class="nb">imag</span><span class="p">(</span><span class="n">e</span><span class="p">),</span><span class="s">&#39;rx&#39;</span><span class="p">);</span>
     <span class="n">title</span><span class="p">(</span><span class="s">&#39;Eigen Values of the inverse of the matrix&#39;</span><span class="p">);</span>

 <span class="k">else</span>


     <span class="c">% Solve the system</span>
     <span class="n">y</span> <span class="p">=</span> <span class="n">A</span><span class="o">\</span><span class="n">b</span><span class="p">;</span>
     <span class="n">linear</span> <span class="p">=</span> <span class="p">(</span><span class="n">lefty</span><span class="o">-</span><span class="n">righty</span><span class="o">+</span><span class="nb">sin</span><span class="p">(</span><span class="n">leftx</span><span class="p">)</span><span class="o">-</span><span class="nb">sin</span><span class="p">(</span><span class="n">rightx</span><span class="p">))</span><span class="o">/</span><span class="p">(</span><span class="n">leftx</span><span class="o">-</span><span class="n">rightx</span><span class="p">);</span>
     <span class="n">constant</span> <span class="p">=</span> <span class="n">lefty</span> <span class="o">+</span> <span class="nb">sin</span><span class="p">(</span><span class="n">leftx</span><span class="p">)</span> <span class="o">-</span> <span class="n">linear</span><span class="o">*</span><span class="n">leftx</span><span class="p">;</span>
     <span class="n">true</span> <span class="p">=</span> <span class="o">-</span><span class="nb">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">linear</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">constant</span><span class="p">;</span>

     <span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span>
     <span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="s">&#39;go&#39;</span><span class="p">,</span><span class="n">x</span><span class="p">,</span><span class="n">true</span><span class="p">,</span><span class="s">&#39;y&#39;</span><span class="p">);</span>
     <span class="n">title</span><span class="p">(</span><span class="s">&#39;True Solution and Approximation&#39;</span><span class="p">);</span>
     <span class="n">xlabel</span><span class="p">(</span><span class="s">&#39;x&#39;</span><span class="p">);</span>
     <span class="n">ylabel</span><span class="p">(</span><span class="s">&#39;y&#39;</span><span class="p">);</span>
     <span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span>
     <span class="n">plot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="nb">abs</span><span class="p">(</span><span class="n">y</span><span class="o">-</span><span class="n">true</span><span class="p">),</span><span class="s">&#39;cx&#39;</span><span class="p">);</span>
     <span class="n">title</span><span class="p">(</span><span class="s">&#39;Error&#39;</span><span class="p">);</span>
     <span class="n">xlabel</span><span class="p">(</span><span class="s">&#39;x&#39;</span><span class="p">);</span>
     <span class="n">ylabel</span><span class="p">(</span><span class="s">&#39;|Error|&#39;</span><span class="p">);</span>


 <span class="k">end</span>
</pre></div>
</td></tr></table></div>
<p>You can execute the instructions in the file by simply typing <em>ifDemo</em>
at the matlab prompt. Try changing the value of the variable
<em>decision</em> to see what actions the script will take. Also, try
changing the other variables and experiment.</p>
<p>The basic form of the <em>if</em>-block is demonstrated in the program above.
You are not required to have an <em>elseif</em> or <em>else</em> block, but you are
required to end the <em>if</em>-block with the <em>endif</em> statement.</p>
</div>
</div>


           </div>
          </div>
          



  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="dataFile.html" class="btn btn-neutral float-right" title="Data Files" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="subroutine.html" class="btn btn-neutral" title="Subroutines" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
		

		<br><br>


<footer>
		<hr/>

		<div role="contentinfo">
          <center>
          <script async src="../../../pagead2.googlesyndication.com/pagead/js/f.txt"></script>
<!-- matlab tutorial wide -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-8301099787686694"
     data-ad-slot="8763269985"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>


			<p>
			<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">Matlab Tutorial</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="mailto:kjblack@gmail.com" property="cc:attributionName" rel="cc:attributionURL">Kelly Black</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a> (2015).<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="index-2.html" rel="dct:source">http://www.cyclismo.org/tutorial/matlab/</a>.
            </p>

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org/">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'3.0',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>
      <script type="text/javascript" src="../../../cdn.mathjax.org/mathjax/latest/MathJaxdda6.js?config=TeX-AMS-MML_HTMLorMML"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
  
<p>
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License" style="border-width:0" src="../../../licensebuttons.net/l/by-nc/4.0/80x15.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">Matlab Tutorial</span> by <a xmlns:cc="http://creativecommons.org/ns#" href=href%3d_mailto_kjblack%40gmail.html property="cc:attributionName" rel="cc:attributionURL">Kelly Black</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="index-2.html" rel="dct:source">http://www.cyclismo.org/tutorial/matlab/</a>.
</p>
<p>This page generated using <a href="http://sphinx-doc.org/">Sphinx</a>.</p>





</body>

<!-- Mirrored from www.cyclismo.org/tutorial/matlab/if.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 04:32:29 GMT -->
</html>